﻿// CPageMainTab.cpp: 实现文件
//

#include "stdafx.h"
#include "MFC_DLL.h"
#include "CPageMainTab.h"
#include "afxdialogex.h"


// CPageMainTab 对话框

IMPLEMENT_DYNAMIC(CPageMainTab, CDialogEx)

CPageMainTab::CPageMainTab(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_DIALOG_TABWND, pParent)
{

}

CPageMainTab::~CPageMainTab()
{
}

void CPageMainTab::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_TAB_MAIN, m_ctl_TabMain);
}


BEGIN_MESSAGE_MAP(CPageMainTab, CDialogEx)
	ON_NOTIFY(TCN_SELCHANGE, IDC_TAB_MAIN, &CPageMainTab::OnTcnSelchangeTabMain)
END_MESSAGE_MAP()


// CPageMainTab 消息处理程序


BOOL CPageMainTab::OnInitDialog()
{
	CDialogEx::OnInitDialog();
	/*TCITEM item;
	item.mask = TCIF_TEXT;
	item.pszText=L"挂机";*/

	RECT tabRect;
	m_ctl_TabMain.GetClientRect(&tabRect);
	tabRect.top += 20;
	tabRect.left += 5;
	tabRect.bottom += -5;
	m_ctl_TabMain.InsertItem(0, L"挂机");
	m_pageGuaJi.Create(IDD_DIALOG_GuaJI);
	m_pageGuaJi.SetParent(&m_ctl_TabMain);
	m_pageGuaJi.MoveWindow(&tabRect);
	m_pageGuaJi.ShowWindow(SW_SHOW);

	m_ctl_TabMain.InsertItem(1, L"测试");
	// TODO:  在此添加额外的初始化

	return TRUE;  // return TRUE unless you set the focus to a control
				  // 异常: OCX 属性页应返回 FALSE
}


void CPageMainTab::OnTcnSelchangeTabMain(NMHDR *pNMHDR, LRESULT *pResult)
{
	// TODO: 在此添加控件通知处理程序代码
	switch (m_ctl_TabMain.GetCurSel())
	{
	case 0:
		m_pageGuaJi.ShowWindow(SW_SHOW);
		break;
	case 1:
		m_pageGuaJi.ShowWindow(SW_HIDE);
		break;
	default:
		break;
	}
	*pResult = 0;
}
